<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button"><input type="button"><input type="button">
<script>
    var aBtn=document.getElementsByTagName('input');
    var arr=[111,222,333];
    for (var i=0;i<aBtn.length;i++){
        aBtn[i].index=i;
        aBtn[i].onclick=function () {
            alert(arr[this.index])
        }
    }
</script>
</body>
</html>